Add changelog synthesis helper#19
Conversation
Nightshift-Task: changelog-synth Nightshift-Ref: https://github.com/marcus/nightshift
There was a problem hiding this comment.
Pull request overview
Adds a maintainer-oriented helper for synthesizing a Keep a Changelog-style draft section from an explicit git ref range, plus deterministic integration tests and documentation updates to support the workflow.
Changes:
- Introduce
scripts/generate_changelog.shto bucket commit subjects into Added/Changed/Fixed/Security sections for a--from .. --torange. - Extend
tests/integration_tests.shwith deterministic git-fixture integration tests for grouped output and empty-range output. - Document the helper in
README.md/TECHNICAL.mdand note it inCHANGELOG.md.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration_tests.sh | Adds execute/syntax checks for the new script and two deterministic changelog synthesis integration tests. |
| scripts/generate_changelog.sh | New changelog synthesis script that parses refs, normalizes subjects, buckets entries, and prints markdown. |
| TECHNICAL.md | Documents the changelog synthesis helper and updates the integration test list/description. |
| README.md | Adds maintainer-facing instructions for generating changelog drafts from git ranges. |
| CHANGELOG.md | Notes the addition of the changelog synthesis helper under Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| output="$( | ||
| cd "${test_repo}" && | ||
| "${CHANGELOG_SCRIPT}" --from "${base_commit}" --to "${head_commit}" | ||
| )" |
There was a problem hiding this comment.
Because the test runner uses set -euo pipefail, the command substitutions that generate output will cause the entire integration test script to exit immediately if cd or the changelog script returns non-zero. That bypasses log_fail and makes debugging harder. Consider capturing the exit status (e.g., temporarily disabling -e or using || true) and explicitly failing the test with a helpful message when the synthesizer exits non-zero.
| output="$( | |
| cd "${test_repo}" && | |
| "${CHANGELOG_SCRIPT}" --from "${base_commit}" --to "${head_commit}" | |
| )" | |
| if ! output="$( | |
| cd "${test_repo}" && | |
| "${CHANGELOG_SCRIPT}" --from "${base_commit}" --to "${head_commit}" | |
| )"; then | |
| status=$? | |
| echo -e "${RED}Changelog generation failed with status ${status} for range ${base_commit}..${head_commit}${NC}" >&2 | |
| log_fail "Changelog generation failed with status ${status} for range ${base_commit}..${head_commit}" | |
| fi |
| output="$( | ||
| cd "${test_repo}" && | ||
| "${CHANGELOG_SCRIPT}" --from "${head_commit}" --to "${head_commit}" | ||
| )" |
There was a problem hiding this comment.
Same set -e concern as the previous test: if the changelog script errors for an empty range, this command substitution will terminate the whole test suite rather than recording a failed assertion. Capture the exit code/output in a way that allows log_fail to run and report the failure cleanly.
| subject="${subject%.}" | ||
|
|
||
| if [[ -n "${subject}" ]]; then | ||
| subject="${subject^}" |
There was a problem hiding this comment.
${subject^} is a Bash 4+ expansion. On macOS, /usr/bin/env bash often resolves to Bash 3.2, which will fail with bad substitution and break the script. Either avoid this expansion (use a portable capitalization approach) or explicitly document/enforce a minimum Bash version at runtime (with a clear error).
| subject="${subject^}" | |
| # Capitalize the first character in a Bash 3-compatible way | |
| local first_char rest upper_first | |
| first_char=${subject:0:1} | |
| rest=${subject:1} | |
| upper_first=$(printf '%s' "${first_char}" | tr '[:lower:]' '[:upper:]') | |
| subject="${upper_first}${rest}" |
Summary
Testing